<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
	private $_model;
	 function _initialize(){
            $this->_model=D('Article');
        }

    public function index(){
        //获取文章标签
//        $tag=D('Tag')->get_data();
//        $this->assign('tag',$tag);

        //调取文章数据
        $data=$this->_model->get_data();
        $count      =$this->_model->count();
        $Page       = new \Think\Page($count,10);
        $Page->setConfig('header', '<li class="rows">共<b>%TOTAL_ROW%</b>条记录&nbsp;第<b>%NOW_PAGE%</b>页/共<b>%TOTAL_PAGE%</b>页</li>');
        $Page->setConfig('prev', '上一页');
        $Page->setConfig('next', '下一页');
        $Page->setConfig('last', '末页');
        $Page->setConfig('first', '首页');
        $Page->setConfig('theme', '%FIRST%%UP_PAGE%%LINK_PAGE%%DOWN_PAGE%%END%%HEADER%');
        $show       = $Page->show();
        $data =$this->_model->limit($Page->firstRow.','.$Page->listRows)->select();
        $this->assign('data',$data);// 赋值数据集
        $this->assign('page',$show);// 赋值分页输出
//        $thumb=json_decode($data['thumb']);

		$this->display();
    }

    public function newlist(){
        $this->display();
    }

    public function about(){
        $data=D('MyInfo')->get_data();
        $this->assign('data',$data);
        $this->display();
    }


}